package webs

import (
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
	"gogogo-server/loginserver/global"
	"net/http"
)

// ClientVerify 客户端登录验证获取token
func ClientVerify(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"token":      "SUCCESS",
		"ServerAddr": global.GGG_LOGIN_CONFIG.ServerAddr,
	})
}

// ServerVerify 服务器验证玩家的登录
func ServerVerify(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"Account": "10Yang",
	})
}

func InitWebService() {
	gin.SetMode(global.GGG_LOGIN_CONFIG.GinMode)
	r := gin.Default()
	r.POST("/client/token", ClientVerify)
	r.POST("/server/verify", ServerVerify)
	zap.S().Fatal(r.Run(global.GGG_LOGIN_CONFIG.ListenAddr))
}
